<template>
    <div class="i-table-no-border">
        <Table ref="table" :columns="columns" :data="data" :loading="loading" size="small">
            <template slot-scope="{ row }" slot="channel">
                <Badge v-if="row.channel === 0" status="success" text="微信"/>
                <Badge v-if="row.channel === 1" status="processing" text="抖音" />
                <Badge v-if="row.channel === 2" status="error" text="市场转诊" />
                <Badge v-if="row.channel === 3" status="warning" text="自然到诊" />
            </template>
            <template slot="action" slot-scope="{row}">
                <a @click="handlePatientDetail">{{row.action}}</a>
            </template>
        </Table>
        <div class="ivu-mt iuv-text-center" slot="footer">
            <Page :total="100" show-elevator show-sizer show-total=""></Page>
        </div>
    </div>
</template>
<script>
    export default {
        data () {
            return {
                loading: false,
                columns: [
                    {
                        title: '基本信息',
                        key: 'basic',
                        minWidth: 138,
                        fixed: 'left'
                    },
                    {
                        title: '诊疗号',
                        key: 'consultant',
                        minWidth: 118
                    },
                    {
                        title: '诊室',
                        key: 'treatmentRoom',
                        minWidth: 100
                    },
                    {
                        title: '到诊时间',
                        key: 'AdvanceTime',
                        sortable: true,
                        minWidth: 150
                    },
                    {
                        title: '电话',
                        key: 'phone',
                        minWidth: 138
                    },
                    {
                        title: '地区',
                        key: 'region',
                        minWidth: 100
                    },
                    {
                        title: '病种',
                        key: 'disease',
                        minWidth: 100
                    },
                    {
                        title: '奕远渠道',
                        minWidth: 120,
                        slot: 'channel'
                    },
                    {
                        title: '操作',
                        minWidth: 90,
                        slot: 'action'
                    }
                ],
                data: [
                    {
                        basic: '刘鸾英 女 26岁',
                        consultant: 13526587,
                        treatmentRoom: '三诊',
                        AdvanceTime: '2016-10-03 16:21',
                        phone: 13385658568,
                        region: '合肥',
                        disease: '白癜风',
                        channel: Math.floor(Math.random() * 2),
                        action: '详细'
                    },
                    {
                        basic: '张在峰 男 36岁',
                        consultant: 13526587,
                        treatmentRoom: '三诊',
                        AdvanceTime: '2016-10-02 13:21',
                        phone: 13385658568,
                        region: '合肥',
                        disease: '白癜风',
                        channel: Math.floor(Math.random() * 2),
                        action: '详细'
                    }
                ]
            }
        },
        methods: {
            handlePatientDetail () {
                this.$router.push('/patient/detailed')
            }
        }
    }
</script>
